package com.sgb.goods.widget.pop.adapter;

import android.view.View;

import androidx.databinding.ObservableBoolean;
import androidx.databinding.ViewDataBinding;

import com.alibaba.android.arouter.launcher.ARouter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sgb.goods.BR;
import com.sgb.goods.R;
import com.sgb.goods.databinding.GoodsItemPopPaymentDetailsBinding;
import com.sgb.goods.entity.PayDetailEntity;
import com.sgb.goods.utils.Constants;
import com.sgb.goods.utils.base.adapter.BaseCommonAdapter;
import com.swgk.core.util.StringUtil;

/**
 * 付款详情适配器
 *
 * @author cyj
 */
public class PaymentDetailsAdapter extends BaseCommonAdapter<PayDetailEntity> {

    public ObservableBoolean isSellOrder = new ObservableBoolean(false);

    public PaymentDetailsAdapter() {
        super(R.layout.goods_item_pop_payment_details);
    }

    @Override
    protected void convert(BaseViewHolder baseHolder, ViewDataBinding dataBinding, PayDetailEntity entity) {
        dataBinding.setVariable(BR.adapter, this);
        dataBinding.setVariable(BR.entity, entity);
    }

    public void setShowProof(boolean isSellOrder) {
        this.isSellOrder.set(isSellOrder);
    }

    /**
     * 预览
     */
    public void preview(String url) {
        if (StringUtil.isEmpty(url)) {
            return;
        }
        ARouter.getInstance().build(Constants.ARouter.AR_PREVIEW)
                .withString("url", url)
                .withString("fileUrl", null)
                .navigation();

    }
}
